package com.qzsoft.zhjd.materiel.modules.materielapi.dto;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;

import org.hibernate.validator.constraints.Length;

import lombok.Data;

/**
 * @ClassName CooperatesProjectSaveDto
 * @Description 供应商、项目添加对象
 * @author linhuawei
 * @since 2022-01-20
 */
@Data
public class SupplierAndProjectSaveDto {

    @NotBlank(message = "供应商标识不可为空")
    @Pattern(regexp = "^[A-Za-z0-9]{32}$", message = "供应商标识格式错误")
    private String id;

    @NotBlank(message = "磅房编号不可为空")
//    @Pattern(regexp = "^JD[0-9]{2}TS[0-9]{1}$", message = "磅房编号格式错误")
    private String siteNO;

    @NotBlank(message = "名称不可为空")
    @Length(max = 20, message = "名称不可超过{max}个字")
    private String name;

    public String getBasecode() {
        return siteNO.substring(0, 4);
    }

}
